package com.example.androidpattern.state.classes;

import android.util.Log;

import com.example.androidpattern.state.interfaces.IState;

/**
 * @ClassName: NoMoneyState$
 * @Description: java类作用描述
 * @Author: xinya
 * @CreateDate: 2020/11/11$ 17:28$
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class NoMoneyState implements IState {
    private static final String TAG = "NoMoneyState";
    private VendingMachine mMachine;

    public NoMoneyState(VendingMachine machine) {
        mMachine = machine;
    }

    @Override
    public void insertMoney() {
        mMachine.setState(mMachine.getHasMoneyState());
        Log.d(TAG, "insertMoney: 投入金钱成功");
    }

    @Override
    public void outMoney() {
        Log.e(TAG, "outMoney: 未投入硬币,拒绝出钱");
    }

    @Override
    public void chooseGoods() {
        Log.e(TAG, "chooseGoods: 请先投币，再选商品！");
    }

    @Override
    public void outGoods() {
        Log.e(TAG, "outGoods: 请先投币,才能出商品!");
    }
}
